import { ref } from "vue"
import axios, { AxiosRequestConfig } from "axios"
export default <T>({ url, method = "GET" }: AxiosRequestConfig) => {
    let request = axios.create({
        baseURL: "http://localhost:8081",
        timeout: 10000
    })
    let data = ref<T | null>(null)
    request.request({
        url,
        method
    }).then(res => {
        data.value = res.data.data
    })
    return {
        data
    }
}